﻿using Lunz.Redis;
using Microsoft.Extensions.DependencyInjection;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace my.cache
{
    public static class ConfigureServicesExtensions
    {
        public static void AddCache(this IServiceCollection services,string redisConn = null) 
        {
            if (string.IsNullOrEmpty(redisConn))
            {
                services.AddSingleton<ICache>(new MemCache());
            }
            else
            { services.AddSingleton<ICache>(new RedisCache(redisConn)); }
        }
    }
}
